package com.miaosha.service;

import com.miaosha.dao.UserDao;
import com.miaosha.domain.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;


@Service
public class UserService {
    @Autowired
    UserDao userDao;
    public User getById(int id){
       return userDao.getById(id);
    }

//    @Transactional
    public boolean tx() {
        User user = new User();
        user.setId(3);
        user.setName("3name");
        userDao.insert(user);

        User user4 = new User();
        user4.setId(1);
        user4.setName("4Name");
        userDao.insert(user4);
        return true;
    }
}
